//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS PCS service.
///
/// Parallel Computing Service (PCS) is a managed service that makes it easier for you to run and scale your high performance computing (HPC) workloads, and build scientific and engineering models on Amazon Web Services using Slurm. For more information, see the Parallel Computing Service User Guide. This reference describes the actions and data types of the service management API. You can use the Amazon Web Services SDKs to call the API actions in software, or use the Command Line Interface (CLI) to call the API actions manually. These API actions manage the service through an Amazon Web Services account. The API actions operate on PCS resources. A resource is an entity in Amazon Web Services that you can work with. Amazon Web Services services create resources when you use the features of the service. Examples of PCS resources include clusters, compute node groups, and queues. For more information about resources in Amazon Web Services, see Resource in the Resource Explorer User Guide.  An PCS compute node is an Amazon EC2 instance. You don't launch compute nodes directly. PCS uses configuration information that you provide to launch compute nodes in your Amazon Web Services account. You receive billing charges for your running compute nodes. PCS automatically terminates your compute nodes when you delete the PCS resources related to those compute nodes.
public struct PCS: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the PCS client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            amzTarget: "AWSParallelComputingService",
            serviceName: "PCS",
            serviceIdentifier: "pcs",
            serviceProtocol: .json(version: "1.0"),
            apiVersion: "2023-02-10",
            endpoint: endpoint,
            errorType: PCSErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }





    // MARK: API Calls

    /// Creates a cluster in your account. PCS creates the cluster controller in a service-owned account. The cluster controller communicates with the cluster resources in your account. The subnets and security groups for the cluster must already exist before you use this API action.  It takes time for PCS to create the cluster. The cluster is in a Creating state until it is ready to use. There can only be 1 cluster in a Creating state per Amazon Web Services Region per Amazon Web Services account. CreateCluster fails with a ServiceQuotaExceededException if there is already a cluster in a Creating state.
    @Sendable
    @inlinable
    public func createCluster(_ input: CreateClusterRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateClusterResponse {
        try await self.client.execute(
            operation: "CreateCluster", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a cluster in your account. PCS creates the cluster controller in a service-owned account. The cluster controller communicates with the cluster resources in your account. The subnets and security groups for the cluster must already exist before you use this API action.  It takes time for PCS to create the cluster. The cluster is in a Creating state until it is ready to use. There can only be 1 cluster in a Creating state per Amazon Web Services Region per Amazon Web Services account. CreateCluster fails with a ServiceQuotaExceededException if there is already a cluster in a Creating state.
    ///
    /// Parameters:
    ///   - clientToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.
    ///   - clusterName: A name to identify the cluster. Example: MyCluster
    ///   - networking: The networking configuration used to set up the cluster's control plane.
    ///   - scheduler: The cluster management and job scheduling software associated with the cluster.
    ///   - size: A value that determines the maximum number of compute nodes in the cluster and the maximum number of jobs (active and queued).    SMALL: 32 compute nodes and 256 jobs    MEDIUM: 512 compute nodes and 8192 jobs    LARGE: 2048 compute nodes and 16,384 jobs
    ///   - slurmConfiguration: Additional options related to the Slurm scheduler.
    ///   - tags: 1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.
    ///   - logger: Logger use during operation
    @inlinable
    public func createCluster(
        clientToken: String? = CreateClusterRequest.idempotencyToken(),
        clusterName: String,
        networking: NetworkingRequest,
        scheduler: SchedulerRequest,
        size: Size,
        slurmConfiguration: ClusterSlurmConfigurationRequest? = nil,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateClusterResponse {
        let input = CreateClusterRequest(
            clientToken: clientToken, 
            clusterName: clusterName, 
            networking: networking, 
            scheduler: scheduler, 
            size: size, 
            slurmConfiguration: slurmConfiguration, 
            tags: tags
        )
        return try await self.createCluster(input, logger: logger)
    }

    /// Creates a managed set of compute nodes. You associate a compute node group with a cluster through 1 or more PCS queues or as part of the login fleet. A compute node group includes the definition of the compute properties and lifecycle management. PCS uses the information you provide to this API action to launch compute nodes in your account. You can only specify subnets in the same Amazon VPC as your cluster. You receive billing charges for the compute nodes that PCS launches in your account. You must already have a launch template before you call this API. For more information, see Launch an instance from a launch template in the Amazon Elastic Compute Cloud User Guide for Linux Instances.
    @Sendable
    @inlinable
    public func createComputeNodeGroup(_ input: CreateComputeNodeGroupRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateComputeNodeGroupResponse {
        try await self.client.execute(
            operation: "CreateComputeNodeGroup", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a managed set of compute nodes. You associate a compute node group with a cluster through 1 or more PCS queues or as part of the login fleet. A compute node group includes the definition of the compute properties and lifecycle management. PCS uses the information you provide to this API action to launch compute nodes in your account. You can only specify subnets in the same Amazon VPC as your cluster. You receive billing charges for the compute nodes that PCS launches in your account. You must already have a launch template before you call this API. For more information, see Launch an instance from a launch template in the Amazon Elastic Compute Cloud User Guide for Linux Instances.
    ///
    /// Parameters:
    ///   - amiId:  The ID of the Amazon Machine Image (AMI) that PCS uses to launch compute nodes (Amazon EC2 instances). If you don't provide this value, PCS uses the AMI ID specified in the custom launch template.
    ///   - clientToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.
    ///   - clusterIdentifier: The name or ID of the cluster to create a compute node group in.
    ///   - computeNodeGroupName: A name to identify the cluster. Example: MyCluster
    ///   - customLaunchTemplate: 
    ///   - iamInstanceProfileArn: The Amazon Resource Name (ARN) of the IAM instance profile used to pass an IAM role when launching EC2 instances. The role contained in your instance profile must have the pcs:RegisterComputeNodeGroupInstance permission and the role name must start with AWSPCS or must have the path /aws-pcs/. For more information, see IAM instance profiles for PCS in the PCS User Guide.
    ///   - instanceConfigs: A list of EC2 instance configurations that PCS can provision in the compute node group.
    ///   - purchaseOption: Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, and Amazon EC2 Capacity Blocks for ML. For more information, see Amazon EC2 billing and purchasing options in the Amazon Elastic Compute Cloud User Guide. For more information about PCS support for Capacity Blocks, see Using Amazon EC2 Capacity Blocks for ML with PCS in the PCS User Guide. If you don't provide this option, it defaults to On-Demand.
    ///   - scalingConfiguration: Specifies the boundaries of the compute node group auto scaling.
    ///   - slurmConfiguration: Additional options related to the Slurm scheduler.
    ///   - spotOptions: 
    ///   - subnetIds: The list of subnet IDs where the compute node group launches instances. Subnets must be in the same VPC as the cluster.
    ///   - tags: 1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.
    ///   - logger: Logger use during operation
    @inlinable
    public func createComputeNodeGroup(
        amiId: String? = nil,
        clientToken: String? = CreateComputeNodeGroupRequest.idempotencyToken(),
        clusterIdentifier: String,
        computeNodeGroupName: String,
        customLaunchTemplate: CustomLaunchTemplate,
        iamInstanceProfileArn: String,
        instanceConfigs: [InstanceConfig],
        purchaseOption: PurchaseOption? = nil,
        scalingConfiguration: ScalingConfigurationRequest,
        slurmConfiguration: ComputeNodeGroupSlurmConfigurationRequest? = nil,
        spotOptions: SpotOptions? = nil,
        subnetIds: [String],
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateComputeNodeGroupResponse {
        let input = CreateComputeNodeGroupRequest(
            amiId: amiId, 
            clientToken: clientToken, 
            clusterIdentifier: clusterIdentifier, 
            computeNodeGroupName: computeNodeGroupName, 
            customLaunchTemplate: customLaunchTemplate, 
            iamInstanceProfileArn: iamInstanceProfileArn, 
            instanceConfigs: instanceConfigs, 
            purchaseOption: purchaseOption, 
            scalingConfiguration: scalingConfiguration, 
            slurmConfiguration: slurmConfiguration, 
            spotOptions: spotOptions, 
            subnetIds: subnetIds, 
            tags: tags
        )
        return try await self.createComputeNodeGroup(input, logger: logger)
    }

    /// Creates a job queue. You must associate 1 or more compute node groups with the queue. You can associate 1 compute node group with multiple queues.
    @Sendable
    @inlinable
    public func createQueue(_ input: CreateQueueRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateQueueResponse {
        try await self.client.execute(
            operation: "CreateQueue", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a job queue. You must associate 1 or more compute node groups with the queue. You can associate 1 compute node group with multiple queues.
    ///
    /// Parameters:
    ///   - clientToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.
    ///   - clusterIdentifier: The name or ID of the cluster for which to create a queue.
    ///   - computeNodeGroupConfigurations: The list of compute node group configurations to associate with the queue. Queues assign jobs to associated compute node groups.
    ///   - queueName: A name to identify the queue.
    ///   - slurmConfiguration: Additional options related to the Slurm scheduler.
    ///   - tags: 1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.
    ///   - logger: Logger use during operation
    @inlinable
    public func createQueue(
        clientToken: String? = CreateQueueRequest.idempotencyToken(),
        clusterIdentifier: String,
        computeNodeGroupConfigurations: [ComputeNodeGroupConfiguration]? = nil,
        queueName: String,
        slurmConfiguration: QueueSlurmConfigurationRequest? = nil,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateQueueResponse {
        let input = CreateQueueRequest(
            clientToken: clientToken, 
            clusterIdentifier: clusterIdentifier, 
            computeNodeGroupConfigurations: computeNodeGroupConfigurations, 
            queueName: queueName, 
            slurmConfiguration: slurmConfiguration, 
            tags: tags
        )
        return try await self.createQueue(input, logger: logger)
    }

    /// Deletes a cluster and all its linked resources. You must delete all queues and compute node groups associated with the cluster before you can delete the cluster.
    @Sendable
    @inlinable
    public func deleteCluster(_ input: DeleteClusterRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteClusterResponse {
        try await self.client.execute(
            operation: "DeleteCluster", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes a cluster and all its linked resources. You must delete all queues and compute node groups associated with the cluster before you can delete the cluster.
    ///
    /// Parameters:
    ///   - clientToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.
    ///   - clusterIdentifier: The name or ID of the cluster to delete.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteCluster(
        clientToken: String? = DeleteClusterRequest.idempotencyToken(),
        clusterIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteClusterResponse {
        let input = DeleteClusterRequest(
            clientToken: clientToken, 
            clusterIdentifier: clusterIdentifier
        )
        return try await self.deleteCluster(input, logger: logger)
    }

    /// Deletes a compute node group. You must delete all queues associated with the compute node group first.
    @Sendable
    @inlinable
    public func deleteComputeNodeGroup(_ input: DeleteComputeNodeGroupRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteComputeNodeGroupResponse {
        try await self.client.execute(
            operation: "DeleteComputeNodeGroup", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes a compute node group. You must delete all queues associated with the compute node group first.
    ///
    /// Parameters:
    ///   - clientToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.
    ///   - clusterIdentifier: The name or ID of the cluster of the compute node group.
    ///   - computeNodeGroupIdentifier: The name or ID of the compute node group to delete.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteComputeNodeGroup(
        clientToken: String? = DeleteComputeNodeGroupRequest.idempotencyToken(),
        clusterIdentifier: String,
        computeNodeGroupIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteComputeNodeGroupResponse {
        let input = DeleteComputeNodeGroupRequest(
            clientToken: clientToken, 
            clusterIdentifier: clusterIdentifier, 
            computeNodeGroupIdentifier: computeNodeGroupIdentifier
        )
        return try await self.deleteComputeNodeGroup(input, logger: logger)
    }

    /// Deletes a job queue. If the compute node group associated with this queue isn't associated with any other queues, PCS terminates all the compute nodes for this queue.
    @Sendable
    @inlinable
    public func deleteQueue(_ input: DeleteQueueRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteQueueResponse {
        try await self.client.execute(
            operation: "DeleteQueue", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes a job queue. If the compute node group associated with this queue isn't associated with any other queues, PCS terminates all the compute nodes for this queue.
    ///
    /// Parameters:
    ///   - clientToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.
    ///   - clusterIdentifier: The name or ID of the cluster of the queue.
    ///   - queueIdentifier: The name or ID of the queue to delete.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteQueue(
        clientToken: String? = DeleteQueueRequest.idempotencyToken(),
        clusterIdentifier: String,
        queueIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteQueueResponse {
        let input = DeleteQueueRequest(
            clientToken: clientToken, 
            clusterIdentifier: clusterIdentifier, 
            queueIdentifier: queueIdentifier
        )
        return try await self.deleteQueue(input, logger: logger)
    }

    /// Returns detailed information about a running cluster in your account. This API action provides networking information, endpoint information for communication with the scheduler, and provisioning status.
    @Sendable
    @inlinable
    public func getCluster(_ input: GetClusterRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetClusterResponse {
        try await self.client.execute(
            operation: "GetCluster", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns detailed information about a running cluster in your account. This API action provides networking information, endpoint information for communication with the scheduler, and provisioning status.
    ///
    /// Parameters:
    ///   - clusterIdentifier: The name or ID of the cluster.
    ///   - logger: Logger use during operation
    @inlinable
    public func getCluster(
        clusterIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetClusterResponse {
        let input = GetClusterRequest(
            clusterIdentifier: clusterIdentifier
        )
        return try await self.getCluster(input, logger: logger)
    }

    /// Returns detailed information about a compute node group. This API action provides networking information, EC2 instance type, compute node group status, and scheduler (such as Slurm) configuration.
    @Sendable
    @inlinable
    public func getComputeNodeGroup(_ input: GetComputeNodeGroupRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetComputeNodeGroupResponse {
        try await self.client.execute(
            operation: "GetComputeNodeGroup", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns detailed information about a compute node group. This API action provides networking information, EC2 instance type, compute node group status, and scheduler (such as Slurm) configuration.
    ///
    /// Parameters:
    ///   - clusterIdentifier: The name or ID of the cluster.
    ///   - computeNodeGroupIdentifier: The name or ID of the compute node group.
    ///   - logger: Logger use during operation
    @inlinable
    public func getComputeNodeGroup(
        clusterIdentifier: String,
        computeNodeGroupIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetComputeNodeGroupResponse {
        let input = GetComputeNodeGroupRequest(
            clusterIdentifier: clusterIdentifier, 
            computeNodeGroupIdentifier: computeNodeGroupIdentifier
        )
        return try await self.getComputeNodeGroup(input, logger: logger)
    }

    /// Returns detailed information about a queue. The information includes the compute node groups that the queue uses to schedule jobs.
    @Sendable
    @inlinable
    public func getQueue(_ input: GetQueueRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetQueueResponse {
        try await self.client.execute(
            operation: "GetQueue", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns detailed information about a queue. The information includes the compute node groups that the queue uses to schedule jobs.
    ///
    /// Parameters:
    ///   - clusterIdentifier: The name or ID of the cluster of the queue.
    ///   - queueIdentifier: The name or ID of the queue.
    ///   - logger: Logger use during operation
    @inlinable
    public func getQueue(
        clusterIdentifier: String,
        queueIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetQueueResponse {
        let input = GetQueueRequest(
            clusterIdentifier: clusterIdentifier, 
            queueIdentifier: queueIdentifier
        )
        return try await self.getQueue(input, logger: logger)
    }

    /// Returns a list of running clusters in your account.
    @Sendable
    @inlinable
    public func listClusters(_ input: ListClustersRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListClustersResponse {
        try await self.client.execute(
            operation: "ListClusters", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of running clusters in your account.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 10 results, and the maximum allowed page size is 100 results. A value of 0 uses the default.
    ///   - nextToken: The value of nextToken is a unique pagination token for each page of results returned. If nextToken is returned, there are more results available. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token returns an HTTP 400 InvalidToken error.
    ///   - logger: Logger use during operation
    @inlinable
    public func listClusters(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListClustersResponse {
        let input = ListClustersRequest(
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listClusters(input, logger: logger)
    }

    /// Returns a list of all compute node groups associated with a cluster.
    @Sendable
    @inlinable
    public func listComputeNodeGroups(_ input: ListComputeNodeGroupsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListComputeNodeGroupsResponse {
        try await self.client.execute(
            operation: "ListComputeNodeGroups", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of all compute node groups associated with a cluster.
    ///
    /// Parameters:
    ///   - clusterIdentifier: The name or ID of the cluster to list compute node groups for.
    ///   - maxResults: The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 10 results, and the maximum allowed page size is 100 results. A value of 0 uses the default.
    ///   - nextToken: The value of nextToken is a unique pagination token for each page of results returned. If nextToken is returned, there are more results available. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token returns an HTTP 400 InvalidToken error.
    ///   - logger: Logger use during operation
    @inlinable
    public func listComputeNodeGroups(
        clusterIdentifier: String,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListComputeNodeGroupsResponse {
        let input = ListComputeNodeGroupsRequest(
            clusterIdentifier: clusterIdentifier, 
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listComputeNodeGroups(input, logger: logger)
    }

    /// Returns a list of all queues associated with a cluster.
    @Sendable
    @inlinable
    public func listQueues(_ input: ListQueuesRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListQueuesResponse {
        try await self.client.execute(
            operation: "ListQueues", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of all queues associated with a cluster.
    ///
    /// Parameters:
    ///   - clusterIdentifier: The name or ID of the cluster to list queues for.
    ///   - maxResults: The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 10 results, and the maximum allowed page size is 100 results. A value of 0 uses the default.
    ///   - nextToken: The value of nextToken is a unique pagination token for each page of results returned. If nextToken is returned, there are more results available. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token returns an HTTP 400 InvalidToken error.
    ///   - logger: Logger use during operation
    @inlinable
    public func listQueues(
        clusterIdentifier: String,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListQueuesResponse {
        let input = ListQueuesRequest(
            clusterIdentifier: clusterIdentifier, 
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listQueues(input, logger: logger)
    }

    /// Returns a list of all tags on an PCS resource.
    @Sendable
    @inlinable
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListTagsForResourceResponse {
        try await self.client.execute(
            operation: "ListTagsForResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a list of all tags on an PCS resource.
    ///
    /// Parameters:
    ///   - resourceArn: The Amazon Resource Name (ARN) of the resource for which to list tags.
    ///   - logger: Logger use during operation
    @inlinable
    public func listTagsForResource(
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListTagsForResourceResponse {
        let input = ListTagsForResourceRequest(
            resourceArn: resourceArn
        )
        return try await self.listTagsForResource(input, logger: logger)
    }

    ///  This API action isn't intended for you to use.  PCS uses this API action to register the compute nodes it launches in your account.
    @Sendable
    @inlinable
    public func registerComputeNodeGroupInstance(_ input: RegisterComputeNodeGroupInstanceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> RegisterComputeNodeGroupInstanceResponse {
        try await self.client.execute(
            operation: "RegisterComputeNodeGroupInstance", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    ///  This API action isn't intended for you to use.  PCS uses this API action to register the compute nodes it launches in your account.
    ///
    /// Parameters:
    ///   - bootstrapId: The client-generated token to allow for retries.
    ///   - clusterIdentifier: The name or ID of the cluster to register the compute node group instance in.
    ///   - logger: Logger use during operation
    @inlinable
    public func registerComputeNodeGroupInstance(
        bootstrapId: String,
        clusterIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> RegisterComputeNodeGroupInstanceResponse {
        let input = RegisterComputeNodeGroupInstanceRequest(
            bootstrapId: bootstrapId, 
            clusterIdentifier: clusterIdentifier
        )
        return try await self.registerComputeNodeGroupInstance(input, logger: logger)
    }

    /// Adds or edits tags on an PCS resource. Each tag consists of a tag key and a tag value. The tag key and tag value are case-sensitive strings. The tag value can be an empty (null) string. To add a tag, specify a new tag key and a tag value. To edit a tag, specify an existing tag key and a new tag value.
    @Sendable
    @inlinable
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "TagResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Adds or edits tags on an PCS resource. Each tag consists of a tag key and a tag value. The tag key and tag value are case-sensitive strings. The tag value can be an empty (null) string. To add a tag, specify a new tag key and a tag value. To edit a tag, specify an existing tag key and a new tag value.
    ///
    /// Parameters:
    ///   - resourceArn: The Amazon Resource Name (ARN) of the resource.
    ///   - tags: 1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.
    ///   - logger: Logger use during operation
    @inlinable
    public func tagResource(
        resourceArn: String,
        tags: [String: String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = TagResourceRequest(
            resourceArn: resourceArn, 
            tags: tags
        )
        return try await self.tagResource(input, logger: logger)
    }

    /// Deletes tags from an PCS resource. To delete a tag, specify the tag key and the Amazon Resource Name (ARN) of the PCS resource.
    @Sendable
    @inlinable
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "UntagResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes tags from an PCS resource. To delete a tag, specify the tag key and the Amazon Resource Name (ARN) of the PCS resource.
    ///
    /// Parameters:
    ///   - resourceArn: The Amazon Resource Name (ARN) of the resource.
    ///   - tagKeys: 1 or more tag keys to remove from the resource. Specify only tag keys and not tag values.
    ///   - logger: Logger use during operation
    @inlinable
    public func untagResource(
        resourceArn: String,
        tagKeys: [String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = UntagResourceRequest(
            resourceArn: resourceArn, 
            tagKeys: tagKeys
        )
        return try await self.untagResource(input, logger: logger)
    }

    /// Updates a cluster configuration. You can modify Slurm scheduler settings, accounting configuration, and security groups for an existing cluster.   You can only update clusters that are in ACTIVE, UPDATE_FAILED, or SUSPENDED state. All associated resources (queues and compute node groups) must be in ACTIVE state before you can update the cluster.
    @Sendable
    @inlinable
    public func updateCluster(_ input: UpdateClusterRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateClusterResponse {
        try await self.client.execute(
            operation: "UpdateCluster", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates a cluster configuration. You can modify Slurm scheduler settings, accounting configuration, and security groups for an existing cluster.   You can only update clusters that are in ACTIVE, UPDATE_FAILED, or SUSPENDED state. All associated resources (queues and compute node groups) must be in ACTIVE state before you can update the cluster.
    ///
    /// Parameters:
    ///   - clientToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.
    ///   - clusterIdentifier: The name or ID of the cluster to update.
    ///   - slurmConfiguration: Additional options related to the Slurm scheduler.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateCluster(
        clientToken: String? = UpdateClusterRequest.idempotencyToken(),
        clusterIdentifier: String,
        slurmConfiguration: UpdateClusterSlurmConfigurationRequest? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateClusterResponse {
        let input = UpdateClusterRequest(
            clientToken: clientToken, 
            clusterIdentifier: clusterIdentifier, 
            slurmConfiguration: slurmConfiguration
        )
        return try await self.updateCluster(input, logger: logger)
    }

    /// Updates a compute node group. You can update many of the fields related to your compute node group including the configurations for networking, compute nodes, and settings specific to your scheduler (such as Slurm).
    @Sendable
    @inlinable
    public func updateComputeNodeGroup(_ input: UpdateComputeNodeGroupRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateComputeNodeGroupResponse {
        try await self.client.execute(
            operation: "UpdateComputeNodeGroup", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates a compute node group. You can update many of the fields related to your compute node group including the configurations for networking, compute nodes, and settings specific to your scheduler (such as Slurm).
    ///
    /// Parameters:
    ///   - amiId: The ID of the Amazon Machine Image (AMI) that PCS uses to launch instances. If not provided, PCS uses the AMI ID specified in the custom launch template.
    ///   - clientToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.
    ///   - clusterIdentifier: The name or ID of the cluster of the compute node group.
    ///   - computeNodeGroupIdentifier: The name or ID of the compute node group.
    ///   - customLaunchTemplate: 
    ///   - iamInstanceProfileArn: The Amazon Resource Name (ARN) of the IAM instance profile used to pass an IAM role when launching EC2 instances. The role contained in your instance profile must have the pcs:RegisterComputeNodeGroupInstance permission and the role name must start with AWSPCS or must have the path /aws-pcs/. For more information, see IAM instance profiles for PCS in the PCS User Guide.
    ///   - purchaseOption: Specifies how EC2 instances are purchased on your behalf. PCS supports On-Demand Instances, Spot Instances, and Amazon EC2 Capacity Blocks for ML. For more information, see Amazon EC2 billing and purchasing options in the Amazon Elastic Compute Cloud User Guide. For more information about PCS support for Capacity Blocks, see Using Amazon EC2 Capacity Blocks for ML with PCS in the PCS User Guide. If you don't provide this option, it defaults to On-Demand.
    ///   - scalingConfiguration: Specifies the boundaries of the compute node group auto scaling.
    ///   - slurmConfiguration: Additional options related to the Slurm scheduler.
    ///   - spotOptions: 
    ///   - subnetIds: The list of subnet IDs where the compute node group provisions instances. The subnets must be in the same VPC as the cluster.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateComputeNodeGroup(
        amiId: String? = nil,
        clientToken: String? = UpdateComputeNodeGroupRequest.idempotencyToken(),
        clusterIdentifier: String,
        computeNodeGroupIdentifier: String,
        customLaunchTemplate: CustomLaunchTemplate? = nil,
        iamInstanceProfileArn: String? = nil,
        purchaseOption: PurchaseOption? = nil,
        scalingConfiguration: ScalingConfigurationRequest? = nil,
        slurmConfiguration: UpdateComputeNodeGroupSlurmConfigurationRequest? = nil,
        spotOptions: SpotOptions? = nil,
        subnetIds: [String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateComputeNodeGroupResponse {
        let input = UpdateComputeNodeGroupRequest(
            amiId: amiId, 
            clientToken: clientToken, 
            clusterIdentifier: clusterIdentifier, 
            computeNodeGroupIdentifier: computeNodeGroupIdentifier, 
            customLaunchTemplate: customLaunchTemplate, 
            iamInstanceProfileArn: iamInstanceProfileArn, 
            purchaseOption: purchaseOption, 
            scalingConfiguration: scalingConfiguration, 
            slurmConfiguration: slurmConfiguration, 
            spotOptions: spotOptions, 
            subnetIds: subnetIds
        )
        return try await self.updateComputeNodeGroup(input, logger: logger)
    }

    /// Updates the compute node group configuration of a queue. Use this API to change the compute node groups that the queue can send jobs to.
    @Sendable
    @inlinable
    public func updateQueue(_ input: UpdateQueueRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateQueueResponse {
        try await self.client.execute(
            operation: "UpdateQueue", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates the compute node group configuration of a queue. Use this API to change the compute node groups that the queue can send jobs to.
    ///
    /// Parameters:
    ///   - clientToken: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.
    ///   - clusterIdentifier: The name or ID of the cluster of the queue.
    ///   - computeNodeGroupConfigurations: The list of compute node group configurations to associate with the queue. Queues assign jobs to associated compute node groups.
    ///   - queueIdentifier: The name or ID of the queue.
    ///   - slurmConfiguration: Additional options related to the Slurm scheduler.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateQueue(
        clientToken: String? = UpdateQueueRequest.idempotencyToken(),
        clusterIdentifier: String,
        computeNodeGroupConfigurations: [ComputeNodeGroupConfiguration]? = nil,
        queueIdentifier: String,
        slurmConfiguration: UpdateQueueSlurmConfigurationRequest? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateQueueResponse {
        let input = UpdateQueueRequest(
            clientToken: clientToken, 
            clusterIdentifier: clusterIdentifier, 
            computeNodeGroupConfigurations: computeNodeGroupConfigurations, 
            queueIdentifier: queueIdentifier, 
            slurmConfiguration: slurmConfiguration
        )
        return try await self.updateQueue(input, logger: logger)
    }
}

extension PCS {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: PCS, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension PCS {
    /// Return PaginatorSequence for operation ``listClusters(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listClustersPaginator(
        _ input: ListClustersRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListClustersRequest, ListClustersResponse> {
        return .init(
            input: input,
            command: self.listClusters,
            inputKey: \ListClustersRequest.nextToken,
            outputKey: \ListClustersResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listClusters(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 10 results, and the maximum allowed page size is 100 results. A value of 0 uses the default.
    ///   - logger: Logger used for logging
    @inlinable
    public func listClustersPaginator(
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListClustersRequest, ListClustersResponse> {
        let input = ListClustersRequest(
            maxResults: maxResults
        )
        return self.listClustersPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listComputeNodeGroups(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listComputeNodeGroupsPaginator(
        _ input: ListComputeNodeGroupsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListComputeNodeGroupsRequest, ListComputeNodeGroupsResponse> {
        return .init(
            input: input,
            command: self.listComputeNodeGroups,
            inputKey: \ListComputeNodeGroupsRequest.nextToken,
            outputKey: \ListComputeNodeGroupsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listComputeNodeGroups(_:logger:)``.
    ///
    /// - Parameters:
    ///   - clusterIdentifier: The name or ID of the cluster to list compute node groups for.
    ///   - maxResults: The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 10 results, and the maximum allowed page size is 100 results. A value of 0 uses the default.
    ///   - logger: Logger used for logging
    @inlinable
    public func listComputeNodeGroupsPaginator(
        clusterIdentifier: String,
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListComputeNodeGroupsRequest, ListComputeNodeGroupsResponse> {
        let input = ListComputeNodeGroupsRequest(
            clusterIdentifier: clusterIdentifier, 
            maxResults: maxResults
        )
        return self.listComputeNodeGroupsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listQueues(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listQueuesPaginator(
        _ input: ListQueuesRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListQueuesRequest, ListQueuesResponse> {
        return .init(
            input: input,
            command: self.listQueues,
            inputKey: \ListQueuesRequest.nextToken,
            outputKey: \ListQueuesResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listQueues(_:logger:)``.
    ///
    /// - Parameters:
    ///   - clusterIdentifier: The name or ID of the cluster to list queues for.
    ///   - maxResults: The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 10 results, and the maximum allowed page size is 100 results. A value of 0 uses the default.
    ///   - logger: Logger used for logging
    @inlinable
    public func listQueuesPaginator(
        clusterIdentifier: String,
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListQueuesRequest, ListQueuesResponse> {
        let input = ListQueuesRequest(
            clusterIdentifier: clusterIdentifier, 
            maxResults: maxResults
        )
        return self.listQueuesPaginator(input, logger: logger)
    }
}

extension PCS.ListClustersRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> PCS.ListClustersRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension PCS.ListComputeNodeGroupsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> PCS.ListComputeNodeGroupsRequest {
        return .init(
            clusterIdentifier: self.clusterIdentifier,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension PCS.ListQueuesRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> PCS.ListQueuesRequest {
        return .init(
            clusterIdentifier: self.clusterIdentifier,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}
